import unittest
from random import choice
from Player import Player

class TestPlayer(unittest.TestCase):
	def setUp(self):
		self.player = Player('X', 'Player1')
		self.listOfMoves = range(9)
	
	def testMoveIllegalInput(self):
		self.assertRaises(ValueError, self.player.move, ['a', 13])
		
	def testMoveLegalInput(self):
		myMove = choice(self.listOfMoves)
		hisMove = self.player.move(myMove)
		self.assertTrue(hisMove != myMove)
		self.assertTrue(hisMove in self.listOfMoves)
		self.assertEqual(len(self.player.legalMoves), 7)
		
def suite():
	suite = unittest.TestLoader().loadTestsFromTestCase(TestPlayer)
	return suite
